﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GetRFINews
{
    /// <summary>
    /// Logique d'interaction pour MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                pb1.Visibility = Visibility.Visible;

            }), System.Windows.Threading.DispatcherPriority.Background);


            Services Services = new Services();
            string url = "http://www.rfi.fr/lffr/statiques/accueil_apprendre.asp";

            string path = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName;
            if (Environment.OSVersion.Version.Major >= 6)
            {
                var test = Directory.GetParent(path);
            }
            try
            {
                var test = Environment.SpecialFolder.LocalApplicationData;
                var test2 = Environment.SpecialFolder.CommonApplicationData;
                //var hi = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.Create), "hi");
            }
            catch (Exception ex)
            {
            }
            Services.GetUrl(url);

            Dispatcher.Invoke(new Action(() =>
            {
                pb1.Visibility = Visibility.Collapsed;

            }), System.Windows.Threading.DispatcherPriority.Background);


        }
    }
}
